package cn.ibizlab.odoo.core.odoo_account.service.impl;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.math.BigInteger;
import java.util.Collection;

import lombok.extern.slf4j.Slf4j;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import cn.ibizlab.odoo.core.client.model.Iaccount_payment;
import cn.ibizlab.odoo.core.odoo_account.domain.Account_payment;
import cn.ibizlab.odoo.core.odoo_account.filter.Account_paymentSearchContext;
import cn.ibizlab.odoo.core.odoo_account.service.IAccount_paymentService;
import cn.ibizlab.odoo.util.SearchResult;
import cn.ibizlab.odoo.util.log.IBIZLog;

/**
 * 实体[付款] 服务对象接口实现
 */
@Slf4j
@IBIZLog
@Service
public class Account_paymentServiceImpl implements IAccount_paymentService {

    @Autowired
    private cn.ibizlab.odoo.core.client.service.Iaccount_paymentClientService account_paymentClientService;

    @Override
    public boolean update(Account_payment account_payment) {
        boolean bOk = false ;
        Iaccount_payment clientModel = this.convert2Model(account_payment,null);
        account_paymentClientService.update(clientModel) ;
        this.convert2Domain(clientModel,account_payment) ;
        bOk = true;
        return bOk ;
    }

    @Override
    public boolean remove(Integer id) {
        boolean bOk = false ;
        Iaccount_payment clientModel = account_paymentClientService.createModel();
        clientModel.setId(id);
        account_paymentClientService.remove(clientModel) ;
        bOk = true ;
        return bOk ;
    }

    @Override
    public void removeBatch(Collection<? extends Serializable> idList, int batchSize) {

        //account_paymentClientService.removeBatch(account_payments) ;

    }

    @Override
    public void updateBatch(List<Account_payment> account_payments, int batchSize) {

        //account_paymentClientService.updateBatch(account_payments,batchSize) ;

    }

    @Override
    public boolean create(Account_payment account_payment) {
        boolean bOk = false ;
        Iaccount_payment clientModel = this.convert2Model(account_payment,null);
        account_paymentClientService.create(clientModel) ;
        this.convert2Domain(clientModel,account_payment);
        bOk = true ;

        return bOk ;
    }

    @Override
    public Account_payment get(Integer id) {
        Iaccount_payment clientModel = account_paymentClientService.createModel();
        clientModel.setId(id);
        account_paymentClientService.get(clientModel) ;
        return this.convert2Domain(clientModel,null);
    }

    @Override
    public Account_payment get(Account_payment account_payment) {
        Account_payment retaccount_payment = this.get(account_payment.getId()) ;
    	BeanCopier copier=BeanCopier.create(retaccount_payment.getClass(), account_payment.getClass(), false);
        copier.copy(retaccount_payment, account_payment, null);
        return account_payment ;
    }

    @Override
    public void createBatch(List<Account_payment> account_payments, int batchSize) {

                        //account_paymentClientService.createBatch(account_payments,batchSize) ;

    }

    /**
     * 查询集合 默认查询
     */
    @Override
    public Page<Account_payment> searchDefault(Account_paymentSearchContext context) {
        List<Account_payment> list = new ArrayList<Account_payment>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_payment> clientModelList = account_paymentClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_payment clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_payment>(list, context.getPageable(), clientModelList.getTotalElements());
    }


    /**
     * 根据科目查询
     */
    @Override
    public Page<Account_payment> selectByOdoo_writeoff_account(Integer id){
        Account_paymentSearchContext context = new Account_paymentSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_payment> list = new ArrayList<Account_payment>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_payment> clientModelList = account_paymentClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_payment clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_payment>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据日记账查询
     */
    @Override
    public Page<Account_payment> selectByOdoo_destination_journal(Integer id){
        Account_paymentSearchContext context = new Account_paymentSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_payment> list = new ArrayList<Account_payment>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_payment> clientModelList = account_paymentClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_payment clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_payment>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据日记账查询
     */
    @Override
    public Page<Account_payment> selectByOdoo_journal(Integer id){
        Account_paymentSearchContext context = new Account_paymentSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_payment> list = new ArrayList<Account_payment>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_payment> clientModelList = account_paymentClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_payment clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_payment>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据付款方法查询
     */
    @Override
    public Page<Account_payment> selectByOdoo_payment_method(Integer id){
        Account_paymentSearchContext context = new Account_paymentSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_payment> list = new ArrayList<Account_payment>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_payment> clientModelList = account_paymentClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_payment clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_payment>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据付款令牌查询
     */
    @Override
    public Page<Account_payment> selectByOdoo_payment_token(Integer id){
        Account_paymentSearchContext context = new Account_paymentSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_payment> list = new ArrayList<Account_payment>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_payment> clientModelList = account_paymentClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_payment clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_payment>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据付款交易查询
     */
    @Override
    public Page<Account_payment> selectByOdoo_payment_transaction(Integer id){
        Account_paymentSearchContext context = new Account_paymentSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_payment> list = new ArrayList<Account_payment>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_payment> clientModelList = account_paymentClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_payment clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_payment>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据币种查询
     */
    @Override
    public Page<Account_payment> selectByOdoo_currency(Integer id){
        Account_paymentSearchContext context = new Account_paymentSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_payment> list = new ArrayList<Account_payment>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_payment> clientModelList = account_paymentClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_payment clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_payment>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据银行账户查询
     */
    @Override
    public Page<Account_payment> selectByOdoo_partner_bank_account(Integer id){
        Account_paymentSearchContext context = new Account_paymentSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_payment> list = new ArrayList<Account_payment>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_payment> clientModelList = account_paymentClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_payment clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_payment>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据联系人查询
     */
    @Override
    public Page<Account_payment> selectByOdoo_partner(Integer id){
        Account_paymentSearchContext context = new Account_paymentSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_payment> list = new ArrayList<Account_payment>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_payment> clientModelList = account_paymentClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_payment clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_payment>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Account_payment> selectByOdoo_create(Integer id){
        Account_paymentSearchContext context = new Account_paymentSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_payment> list = new ArrayList<Account_payment>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_payment> clientModelList = account_paymentClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_payment clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_payment>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Account_payment> selectByOdoo_write(Integer id){
        Account_paymentSearchContext context = new Account_paymentSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_payment> list = new ArrayList<Account_payment>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_payment> clientModelList = account_paymentClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_payment clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_payment>(list, context.getPageable(), clientModelList.getTotalElements());

    }



    public Iaccount_payment convert2Model(Account_payment domain , Iaccount_payment model) {
        if(domain == null)
            return model ;
        if(model==null){
            model = account_paymentClientService.createModel() ;
        }

         if(domain.getInvoice_idsDirtyFlag())
            model.setInvoice_ids(domain.getInvoice_ids());
         if(domain.getMessage_needactionDirtyFlag())
            model.setMessage_needaction(domain.getMessage_needaction());
         if(domain.getDisplay_nameDirtyFlag())
            model.setDisplay_name(domain.getDisplay_name());
         if(domain.getMessage_needaction_counterDirtyFlag())
            model.setMessage_needaction_counter(domain.getMessage_needaction_counter());
         if(domain.getPayment_typeDirtyFlag())
            model.setPayment_type(domain.getPayment_type());
         if(domain.getMessage_channel_idsDirtyFlag())
            model.setMessage_channel_ids(domain.getMessage_channel_ids());
         if(domain.getHas_invoicesDirtyFlag())
            model.setHas_invoices(domain.getHas_invoices());
         if(domain.getPayment_dateDirtyFlag())
            model.setPayment_date(domain.getPayment_date());
         if(domain.getMultiDirtyFlag())
            model.setMulti(domain.getMulti());
         if(domain.getMessage_attachment_countDirtyFlag())
            model.setMessage_attachment_count(domain.getMessage_attachment_count());
         if(domain.getNameDirtyFlag())
            model.setName(domain.getName());
         if(domain.getMove_reconciledDirtyFlag())
            model.setMove_reconciled(domain.getMove_reconciled());
         if(domain.getDestination_account_idDirtyFlag())
            model.setDestination_account_id(domain.getDestination_account_id());
         if(domain.getMessage_has_errorDirtyFlag())
            model.setMessage_has_error(domain.getMessage_has_error());
         if(domain.getMessage_main_attachment_idDirtyFlag())
            model.setMessage_main_attachment_id(domain.getMessage_main_attachment_id());
         if(domain.getMessage_unreadDirtyFlag())
            model.setMessage_unread(domain.getMessage_unread());
         if(domain.getPayment_differenceDirtyFlag())
            model.setPayment_difference(domain.getPayment_difference());
         if(domain.getMessage_follower_idsDirtyFlag())
            model.setMessage_follower_ids(domain.getMessage_follower_ids());
         if(domain.getMessage_has_error_counterDirtyFlag())
            model.setMessage_has_error_counter(domain.getMessage_has_error_counter());
         if(domain.getPayment_difference_handlingDirtyFlag())
            model.setPayment_difference_handling(domain.getPayment_difference_handling());
         if(domain.getReconciled_invoice_idsDirtyFlag())
            model.setReconciled_invoice_ids(domain.getReconciled_invoice_ids());
         if(domain.getPayment_referenceDirtyFlag())
            model.setPayment_reference(domain.getPayment_reference());
         if(domain.getWriteoff_labelDirtyFlag())
            model.setWriteoff_label(domain.getWriteoff_label());
         if(domain.getMove_line_idsDirtyFlag())
            model.setMove_line_ids(domain.getMove_line_ids());
         if(domain.getWebsite_message_idsDirtyFlag())
            model.setWebsite_message_ids(domain.getWebsite_message_ids());
         if(domain.getWrite_dateDirtyFlag())
            model.setWrite_date(domain.getWrite_date());
         if(domain.getAmountDirtyFlag())
            model.setAmount(domain.getAmount());
         if(domain.getShow_partner_bank_accountDirtyFlag())
            model.setShow_partner_bank_account(domain.getShow_partner_bank_account());
         if(domain.getCreate_dateDirtyFlag())
            model.setCreate_date(domain.getCreate_date());
         if(domain.getPartner_typeDirtyFlag())
            model.setPartner_type(domain.getPartner_type());
         if(domain.getMessage_idsDirtyFlag())
            model.setMessage_ids(domain.getMessage_ids());
         if(domain.get__last_updateDirtyFlag())
            model.set__last_update(domain.get__last_update());
         if(domain.getCommunicationDirtyFlag())
            model.setCommunication(domain.getCommunication());
         if(domain.getStateDirtyFlag())
            model.setState(domain.getState());
         if(domain.getIdDirtyFlag())
            model.setId(domain.getId());
         if(domain.getMessage_partner_idsDirtyFlag())
            model.setMessage_partner_ids(domain.getMessage_partner_ids());
         if(domain.getMessage_is_followerDirtyFlag())
            model.setMessage_is_follower(domain.getMessage_is_follower());
         if(domain.getHide_payment_methodDirtyFlag())
            model.setHide_payment_method(domain.getHide_payment_method());
         if(domain.getMove_nameDirtyFlag())
            model.setMove_name(domain.getMove_name());
         if(domain.getMessage_unread_counterDirtyFlag())
            model.setMessage_unread_counter(domain.getMessage_unread_counter());
         if(domain.getDestination_journal_id_textDirtyFlag())
            model.setDestination_journal_id_text(domain.getDestination_journal_id_text());
         if(domain.getPayment_method_codeDirtyFlag())
            model.setPayment_method_code(domain.getPayment_method_code());
         if(domain.getWrite_uid_textDirtyFlag())
            model.setWrite_uid_text(domain.getWrite_uid_text());
         if(domain.getJournal_id_textDirtyFlag())
            model.setJournal_id_text(domain.getJournal_id_text());
         if(domain.getCreate_uid_textDirtyFlag())
            model.setCreate_uid_text(domain.getCreate_uid_text());
         if(domain.getWriteoff_account_id_textDirtyFlag())
            model.setWriteoff_account_id_text(domain.getWriteoff_account_id_text());
         if(domain.getCurrency_id_textDirtyFlag())
            model.setCurrency_id_text(domain.getCurrency_id_text());
         if(domain.getPayment_method_id_textDirtyFlag())
            model.setPayment_method_id_text(domain.getPayment_method_id_text());
         if(domain.getPayment_token_id_textDirtyFlag())
            model.setPayment_token_id_text(domain.getPayment_token_id_text());
         if(domain.getCompany_idDirtyFlag())
            model.setCompany_id(domain.getCompany_id());
         if(domain.getPartner_id_textDirtyFlag())
            model.setPartner_id_text(domain.getPartner_id_text());
         if(domain.getWrite_uidDirtyFlag())
            model.setWrite_uid(domain.getWrite_uid());
         if(domain.getPayment_token_idDirtyFlag())
            model.setPayment_token_id(domain.getPayment_token_id());
         if(domain.getPayment_transaction_idDirtyFlag())
            model.setPayment_transaction_id(domain.getPayment_transaction_id());
         if(domain.getWriteoff_account_idDirtyFlag())
            model.setWriteoff_account_id(domain.getWriteoff_account_id());
         if(domain.getPartner_bank_account_idDirtyFlag())
            model.setPartner_bank_account_id(domain.getPartner_bank_account_id());
         if(domain.getCreate_uidDirtyFlag())
            model.setCreate_uid(domain.getCreate_uid());
         if(domain.getPayment_method_idDirtyFlag())
            model.setPayment_method_id(domain.getPayment_method_id());
         if(domain.getDestination_journal_idDirtyFlag())
            model.setDestination_journal_id(domain.getDestination_journal_id());
         if(domain.getPartner_idDirtyFlag())
            model.setPartner_id(domain.getPartner_id());
         if(domain.getJournal_idDirtyFlag())
            model.setJournal_id(domain.getJournal_id());
         if(domain.getCurrency_idDirtyFlag())
            model.setCurrency_id(domain.getCurrency_id());
        return model ;
    }

    public Account_payment convert2Domain( Iaccount_payment model ,Account_payment domain) {
        if(model == null)
            return domain ;
        if(domain == null){
            domain = new Account_payment();
        }

        if(model.getInvoice_idsDirtyFlag())
            domain.setInvoice_ids(model.getInvoice_ids());
        if(model.getMessage_needactionDirtyFlag())
            domain.setMessage_needaction(model.getMessage_needaction());
        if(model.getDisplay_nameDirtyFlag())
            domain.setDisplay_name(model.getDisplay_name());
        if(model.getMessage_needaction_counterDirtyFlag())
            domain.setMessage_needaction_counter(model.getMessage_needaction_counter());
        if(model.getPayment_typeDirtyFlag())
            domain.setPayment_type(model.getPayment_type());
        if(model.getMessage_channel_idsDirtyFlag())
            domain.setMessage_channel_ids(model.getMessage_channel_ids());
        if(model.getHas_invoicesDirtyFlag())
            domain.setHas_invoices(model.getHas_invoices());
        if(model.getPayment_dateDirtyFlag())
            domain.setPayment_date(model.getPayment_date());
        if(model.getMultiDirtyFlag())
            domain.setMulti(model.getMulti());
        if(model.getMessage_attachment_countDirtyFlag())
            domain.setMessage_attachment_count(model.getMessage_attachment_count());
        if(model.getNameDirtyFlag())
            domain.setName(model.getName());
        if(model.getMove_reconciledDirtyFlag())
            domain.setMove_reconciled(model.getMove_reconciled());
        if(model.getDestination_account_idDirtyFlag())
            domain.setDestination_account_id(model.getDestination_account_id());
        if(model.getMessage_has_errorDirtyFlag())
            domain.setMessage_has_error(model.getMessage_has_error());
        if(model.getMessage_main_attachment_idDirtyFlag())
            domain.setMessage_main_attachment_id(model.getMessage_main_attachment_id());
        if(model.getMessage_unreadDirtyFlag())
            domain.setMessage_unread(model.getMessage_unread());
        if(model.getPayment_differenceDirtyFlag())
            domain.setPayment_difference(model.getPayment_difference());
        if(model.getMessage_follower_idsDirtyFlag())
            domain.setMessage_follower_ids(model.getMessage_follower_ids());
        if(model.getMessage_has_error_counterDirtyFlag())
            domain.setMessage_has_error_counter(model.getMessage_has_error_counter());
        if(model.getPayment_difference_handlingDirtyFlag())
            domain.setPayment_difference_handling(model.getPayment_difference_handling());
        if(model.getReconciled_invoice_idsDirtyFlag())
            domain.setReconciled_invoice_ids(model.getReconciled_invoice_ids());
        if(model.getPayment_referenceDirtyFlag())
            domain.setPayment_reference(model.getPayment_reference());
        if(model.getWriteoff_labelDirtyFlag())
            domain.setWriteoff_label(model.getWriteoff_label());
        if(model.getMove_line_idsDirtyFlag())
            domain.setMove_line_ids(model.getMove_line_ids());
        if(model.getWebsite_message_idsDirtyFlag())
            domain.setWebsite_message_ids(model.getWebsite_message_ids());
        if(model.getWrite_dateDirtyFlag())
            domain.setWrite_date(model.getWrite_date());
        if(model.getAmountDirtyFlag())
            domain.setAmount(model.getAmount());
        if(model.getShow_partner_bank_accountDirtyFlag())
            domain.setShow_partner_bank_account(model.getShow_partner_bank_account());
        if(model.getCreate_dateDirtyFlag())
            domain.setCreate_date(model.getCreate_date());
        if(model.getPartner_typeDirtyFlag())
            domain.setPartner_type(model.getPartner_type());
        if(model.getMessage_idsDirtyFlag())
            domain.setMessage_ids(model.getMessage_ids());
        if(model.get__last_updateDirtyFlag())
            domain.set__last_update(model.get__last_update());
        if(model.getCommunicationDirtyFlag())
            domain.setCommunication(model.getCommunication());
        if(model.getStateDirtyFlag())
            domain.setState(model.getState());
        if(model.getIdDirtyFlag())
            domain.setId(model.getId());
        if(model.getMessage_partner_idsDirtyFlag())
            domain.setMessage_partner_ids(model.getMessage_partner_ids());
        if(model.getMessage_is_followerDirtyFlag())
            domain.setMessage_is_follower(model.getMessage_is_follower());
        if(model.getHide_payment_methodDirtyFlag())
            domain.setHide_payment_method(model.getHide_payment_method());
        if(model.getMove_nameDirtyFlag())
            domain.setMove_name(model.getMove_name());
        if(model.getMessage_unread_counterDirtyFlag())
            domain.setMessage_unread_counter(model.getMessage_unread_counter());
        if(model.getDestination_journal_id_textDirtyFlag())
            domain.setDestination_journal_id_text(model.getDestination_journal_id_text());
        if(model.getPayment_method_codeDirtyFlag())
            domain.setPayment_method_code(model.getPayment_method_code());
        if(model.getWrite_uid_textDirtyFlag())
            domain.setWrite_uid_text(model.getWrite_uid_text());
        if(model.getJournal_id_textDirtyFlag())
            domain.setJournal_id_text(model.getJournal_id_text());
        if(model.getCreate_uid_textDirtyFlag())
            domain.setCreate_uid_text(model.getCreate_uid_text());
        if(model.getWriteoff_account_id_textDirtyFlag())
            domain.setWriteoff_account_id_text(model.getWriteoff_account_id_text());
        if(model.getCurrency_id_textDirtyFlag())
            domain.setCurrency_id_text(model.getCurrency_id_text());
        if(model.getPayment_method_id_textDirtyFlag())
            domain.setPayment_method_id_text(model.getPayment_method_id_text());
        if(model.getPayment_token_id_textDirtyFlag())
            domain.setPayment_token_id_text(model.getPayment_token_id_text());
        if(model.getCompany_idDirtyFlag())
            domain.setCompany_id(model.getCompany_id());
        if(model.getPartner_id_textDirtyFlag())
            domain.setPartner_id_text(model.getPartner_id_text());
        if(model.getWrite_uidDirtyFlag())
            domain.setWrite_uid(model.getWrite_uid());
        if(model.getPayment_token_idDirtyFlag())
            domain.setPayment_token_id(model.getPayment_token_id());
        if(model.getPayment_transaction_idDirtyFlag())
            domain.setPayment_transaction_id(model.getPayment_transaction_id());
        if(model.getWriteoff_account_idDirtyFlag())
            domain.setWriteoff_account_id(model.getWriteoff_account_id());
        if(model.getPartner_bank_account_idDirtyFlag())
            domain.setPartner_bank_account_id(model.getPartner_bank_account_id());
        if(model.getCreate_uidDirtyFlag())
            domain.setCreate_uid(model.getCreate_uid());
        if(model.getPayment_method_idDirtyFlag())
            domain.setPayment_method_id(model.getPayment_method_id());
        if(model.getDestination_journal_idDirtyFlag())
            domain.setDestination_journal_id(model.getDestination_journal_id());
        if(model.getPartner_idDirtyFlag())
            domain.setPartner_id(model.getPartner_id());
        if(model.getJournal_idDirtyFlag())
            domain.setJournal_id(model.getJournal_id());
        if(model.getCurrency_idDirtyFlag())
            domain.setCurrency_id(model.getCurrency_id());
        return domain ;
    }


}
